public class Student {
    private String studentId;
    private String name;
    private String major;

    public Student(){
    }

    public Student(String studentId, String name, String major) {
        //this.studentId = studentId;
        if(!setStudentId(studentId)){
            return;
        };
        this.name = name;
        this.major = major;
    }

    public String getStudentId() {
        return studentId;
    }

    public boolean setStudentId(String studentId) {

        if(studentId == null || studentId.isEmpty()){
            System.out.println("学号不能为空。");
            return false;
        }
        this.studentId = studentId;
        return true;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    @Override
    public String toString() {
        return "学号：" + studentId + ",姓名：" + name + ",专业：" +  major;
    }
}
